package com.runshu.newsmartark.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import androidx.room.Ignore;

import java.util.ArrayList;
import java.util.List;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/8/26
 * @decs：
 */

public class ConfirmStockEntity implements Parcelable {


    /**
     * allStock : 21
     * userName : 张三
     * office : 心内科
     * isAdd : true
     * stockChange : +8
     * allProducts : [{"id":"","serialNo":"","productNo":"B.112.002.0018","productName":"造影导丝(InQwire)","productModel":"IQ35F180J3","batchNo":"K1768471","periodDate":"2023-01-23","createTime":"","remark":"","isStockWaring":0,"isPeriodWaring":0,"manufacturer":"美国麦瑞通医疗设备有限公司","productTime":"","warnDateNumber":"","warnValue":"","stock":10,"inventoryStatus":"","hwName":"","surplusDays":"","dataSource":0,"stockName":"","classification":"","company":"","productAttribute":"","registNo":"","storageCondition":"","number":"","updateTime":"","hospitalId":"","isAdd":true,"stockChange":"+12"},{"id":"","serialNo":"","productNo":"B.112.002.0018","productName":"测试耗材(InQwire)","productModel":"IQ35F180J3","batchNo":"K1768471","periodDate":"2023-01-23","createTime":"","remark":"","isStockWaring":0,"isPeriodWaring":0,"manufacturer":"美国麦瑞通医疗设备有限公司","productTime":"","warnDateNumber":"","warnValue":"","stock":11,"inventoryStatus":"","hwName":"","surplusDays":"","dataSource":0,"stockName":"","classification":"","company":"","productAttribute":"","registNo":"","storageCondition":"","number":"","updateTime":"","hospitalId":"","isAdd":false,"stockChange":"-3"}]
     */

    private int allStock;
    private String userName;
    private String office;
    private boolean isAdd;
    private String stockChange;
    private String type;
    private String stateStr;

    public String getStateStr() {
        return stateStr == null ? "" : stateStr;
    }

    public void setStateStr(String stateStr) {
        this.stateStr = stateStr == null ? "" : stateStr;
    }

    public static Creator<ConfirmStockEntity> getCREATOR() {
        return CREATOR;
    }

    private List<AllProductsBean> allProducts;

    public String getType() {
        return type == null ? "" : type;
    }

    public void setType(String type) {
        this.type = type == null ? "" : type;
    }

    public int getAllStock() {
        return allStock;
    }

    public void setAllStock(int allStock) {
        this.allStock = allStock;
    }

    public String getUserName() {
        return userName == null ? "" : userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? "" : userName;
    }

    public String getOffice() {
        return office == null ? "" : office;
    }

    public void setOffice(String office) {
        this.office = office == null ? "" : office;
    }

    public boolean isAdd() {
        return isAdd;
    }

    public void setAdd(boolean add) {
        isAdd = add;
    }

    public String getStockChange() {
        return stockChange == null ? "" : stockChange;
    }

    public void setStockChange(String stockChange) {
        this.stockChange = stockChange == null ? "" : stockChange;
    }

    public List<AllProductsBean> getAllProducts() {
        if (allProducts == null) {
            return new ArrayList<>();
        }
        return allProducts;
    }

    public void setAllProducts(List<AllProductsBean> allProducts) {
        this.allProducts = allProducts;
    }

    public static class AllProductsBean implements Parcelable {
        /**
         * id :
         * serialNo :
         * productNo : B.112.002.0018
         * productName : 造影导丝(InQwire)
         * productModel : IQ35F180J3
         * batchNo : K1768471
         * periodDate : 2023-01-23
         * createTime :
         * remark :
         * isStockWaring : 0
         * isPeriodWaring : 0
         * manufacturer : 美国麦瑞通医疗设备有限公司
         * productTime :
         * warnDateNumber :
         * warnValue :
         * stock : 10
         * inventoryStatus :
         * hwName :
         * surplusDays :
         * dataSource : 0
         * stockName :
         * classification :
         * company :
         * productAttribute :
         * registNo :
         * storageCondition :
         * number :
         * updateTime :
         * hospitalId :
         * isAdd : true
         * stockChange : +12
         */
        private String productCategory;
        @Ignore
        private String id;
        @Ignore
        private String serialNo;
        private String productNo;
        private String productName;
        private String productModel;
        private String batchNo;
        private String periodDate;
        @Ignore
        private String createTime;
        @Ignore
        private String remark;
        @Ignore
        private int isStockWaring;
        @Ignore
        private int isPeriodWaring;
        private String manufacturer;
        @Ignore
        private String productTime;
        @Ignore
        private String warnDateNumber;
        @Ignore
        private String warnValue;
        @Ignore
        private int stock;
        @Ignore
        private String inventoryStatus;
        @Ignore
        private String hwName;
        @Ignore
        private String surplusDays;
        @Ignore
        private int dataSource;
        @Ignore
        private String stockName;
        @Ignore
        private String classification;
        @Ignore
        private String company;
        @Ignore
        private String productAttribute;
        @Ignore
        private String registNo;
        @Ignore
        private String storageCondition;
        @Ignore
        private String number;
        @Ignore
        private String updateTime;
        @Ignore
        private String hospitalId;
        private boolean isAdd;
        private String stockChange;

        public String getProductCategory() {
            return productCategory == null ? "" : productCategory;
        }

        public void setProductCategory(String productCategory) {
            this.productCategory = productCategory == null ? "" : productCategory;
        }

        public static Creator<AllProductsBean> getCREATOR() {
            return CREATOR;
        }

        public String getId() {
            return id == null ? "" : id;
        }

        public void setId(String id) {
            this.id = id == null ? "" : id;
        }

        public String getSerialNo() {
            return serialNo == null ? "" : serialNo;
        }

        public void setSerialNo(String serialNo) {
            this.serialNo = serialNo == null ? "" : serialNo;
        }

        public String getProductNo() {
            return productNo == null ? "" : productNo;
        }

        public void setProductNo(String productNo) {
            this.productNo = productNo == null ? "" : productNo;
        }

        public String getProductName() {
            return productName == null ? "" : productName;
        }

        public void setProductName(String productName) {
            this.productName = productName == null ? "" : productName;
        }

        public String getProductModel() {
            return productModel == null ? "" : productModel;
        }

        public void setProductModel(String productModel) {
            this.productModel = productModel == null ? "" : productModel;
        }

        public String getBatchNo() {
            return batchNo == null ? "" : batchNo;
        }

        public void setBatchNo(String batchNo) {
            this.batchNo = batchNo == null ? "" : batchNo;
        }

        public String getPeriodDate() {
            return periodDate == null ? "" : periodDate;
        }

        public void setPeriodDate(String periodDate) {
            this.periodDate = periodDate == null ? "" : periodDate;
        }

        public String getCreateTime() {
            return createTime == null ? "" : createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime == null ? "" : createTime;
        }

        public String getRemark() {
            return remark == null ? "" : remark;
        }

        public void setRemark(String remark) {
            this.remark = remark == null ? "" : remark;
        }

        public int getIsStockWaring() {
            return isStockWaring;
        }

        public void setIsStockWaring(int isStockWaring) {
            this.isStockWaring = isStockWaring;
        }

        public int getIsPeriodWaring() {
            return isPeriodWaring;
        }

        public void setIsPeriodWaring(int isPeriodWaring) {
            this.isPeriodWaring = isPeriodWaring;
        }

        public String getManufacturer() {
            return manufacturer == null ? "" : manufacturer;
        }

        public void setManufacturer(String manufacturer) {
            this.manufacturer = manufacturer == null ? "" : manufacturer;
        }

        public String getProductTime() {
            return productTime == null ? "" : productTime;
        }

        public void setProductTime(String productTime) {
            this.productTime = productTime == null ? "" : productTime;
        }

        public String getWarnDateNumber() {
            return warnDateNumber == null ? "" : warnDateNumber;
        }

        public void setWarnDateNumber(String warnDateNumber) {
            this.warnDateNumber = warnDateNumber == null ? "" : warnDateNumber;
        }

        public String getWarnValue() {
            return warnValue == null ? "" : warnValue;
        }

        public void setWarnValue(String warnValue) {
            this.warnValue = warnValue == null ? "" : warnValue;
        }

        public int getStock() {
            return stock;
        }

        public void setStock(int stock) {
            this.stock = stock;
        }

        public String getInventoryStatus() {
            return inventoryStatus == null ? "" : inventoryStatus;
        }

        public void setInventoryStatus(String inventoryStatus) {
            this.inventoryStatus = inventoryStatus == null ? "" : inventoryStatus;
        }

        public String getHwName() {
            return hwName == null ? "" : hwName;
        }

        public void setHwName(String hwName) {
            this.hwName = hwName == null ? "" : hwName;
        }

        public String getSurplusDays() {
            return surplusDays == null ? "" : surplusDays;
        }

        public void setSurplusDays(String surplusDays) {
            this.surplusDays = surplusDays == null ? "" : surplusDays;
        }

        public int getDataSource() {
            return dataSource;
        }

        public void setDataSource(int dataSource) {
            this.dataSource = dataSource;
        }

        public String getStockName() {
            return stockName == null ? "" : stockName;
        }

        public void setStockName(String stockName) {
            this.stockName = stockName == null ? "" : stockName;
        }

        public String getClassification() {
            return classification == null ? "" : classification;
        }

        public void setClassification(String classification) {
            this.classification = classification == null ? "" : classification;
        }

        public String getCompany() {
            return company == null ? "" : company;
        }

        public void setCompany(String company) {
            this.company = company == null ? "" : company;
        }

        public String getProductAttribute() {
            return productAttribute == null ? "" : productAttribute;
        }

        public void setProductAttribute(String productAttribute) {
            this.productAttribute = productAttribute == null ? "" : productAttribute;
        }

        public String getRegistNo() {
            return registNo == null ? "" : registNo;
        }

        public void setRegistNo(String registNo) {
            this.registNo = registNo == null ? "" : registNo;
        }

        public String getStorageCondition() {
            return storageCondition == null ? "" : storageCondition;
        }

        public void setStorageCondition(String storageCondition) {
            this.storageCondition = storageCondition == null ? "" : storageCondition;
        }

        public String getNumber() {
            return number == null ? "" : number;
        }

        public void setNumber(String number) {
            this.number = number == null ? "" : number;
        }

        public String getUpdateTime() {
            return updateTime == null ? "" : updateTime;
        }

        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime == null ? "" : updateTime;
        }

        public String getHospitalId() {
            return hospitalId == null ? "" : hospitalId;
        }

        public void setHospitalId(String hospitalId) {
            this.hospitalId = hospitalId == null ? "" : hospitalId;
        }

        public boolean isAdd() {
            return isAdd;
        }

        public void setAdd(boolean add) {
            isAdd = add;
        }

        public String getStockChange() {
            return stockChange == null ? "0" : (isAdd ? "+" + stockChange : "-" + stockChange);
        }
        public int getStockChangeNum(){
            return TextUtils.isEmpty(stockChange)?0:(isAdd?Integer.valueOf(stockChange):-Integer.valueOf(stockChange));
        }
        public void setStockChange(String stockChange) {
            this.stockChange = stockChange == null ? "" : stockChange;
        }
        public void setStockChangeNum(int change){
            isAdd=(change>=0);
            stockChange=String.valueOf(change>0?change:-change);
        }
        public AllProductsBean() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString( this.productCategory );
            dest.writeString( this.id );
            dest.writeString( this.serialNo );
            dest.writeString( this.productNo );
            dest.writeString( this.productName );
            dest.writeString( this.productModel );
            dest.writeString( this.batchNo );
            dest.writeString( this.periodDate );
            dest.writeString( this.createTime );
            dest.writeString( this.remark );
            dest.writeInt( this.isStockWaring );
            dest.writeInt( this.isPeriodWaring );
            dest.writeString( this.manufacturer );
            dest.writeString( this.productTime );
            dest.writeString( this.warnDateNumber );
            dest.writeString( this.warnValue );
            dest.writeInt( this.stock );
            dest.writeString( this.inventoryStatus );
            dest.writeString( this.hwName );
            dest.writeString( this.surplusDays );
            dest.writeInt( this.dataSource );
            dest.writeString( this.stockName );
            dest.writeString( this.classification );
            dest.writeString( this.company );
            dest.writeString( this.productAttribute );
            dest.writeString( this.registNo );
            dest.writeString( this.storageCondition );
            dest.writeString( this.number );
            dest.writeString( this.updateTime );
            dest.writeString( this.hospitalId );
            dest.writeByte( this.isAdd ? (byte) 1 : (byte) 0 );
            dest.writeString( this.stockChange );
        }

        protected AllProductsBean(Parcel in) {
            this.productCategory = in.readString();
            this.id = in.readString();
            this.serialNo = in.readString();
            this.productNo = in.readString();
            this.productName = in.readString();
            this.productModel = in.readString();
            this.batchNo = in.readString();
            this.periodDate = in.readString();
            this.createTime = in.readString();
            this.remark = in.readString();
            this.isStockWaring = in.readInt();
            this.isPeriodWaring = in.readInt();
            this.manufacturer = in.readString();
            this.productTime = in.readString();
            this.warnDateNumber = in.readString();
            this.warnValue = in.readString();
            this.stock = in.readInt();
            this.inventoryStatus = in.readString();
            this.hwName = in.readString();
            this.surplusDays = in.readString();
            this.dataSource = in.readInt();
            this.stockName = in.readString();
            this.classification = in.readString();
            this.company = in.readString();
            this.productAttribute = in.readString();
            this.registNo = in.readString();
            this.storageCondition = in.readString();
            this.number = in.readString();
            this.updateTime = in.readString();
            this.hospitalId = in.readString();
            this.isAdd = in.readByte() != 0;
            this.stockChange = in.readString();
        }

        public static final Creator<AllProductsBean> CREATOR = new Creator<AllProductsBean>() {
            @Override
            public AllProductsBean createFromParcel(Parcel source) {
                return new AllProductsBean( source );
            }

            @Override
            public AllProductsBean[] newArray(int size) {
                return new AllProductsBean[size];
            }
        };
    }

    public ConfirmStockEntity() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt( this.allStock );
        dest.writeString( this.userName );
        dest.writeString( this.office );
        dest.writeByte( this.isAdd ? (byte) 1 : (byte) 0 );
        dest.writeString( this.stockChange );
        dest.writeString( this.type );
        dest.writeString( this.stateStr );
        dest.writeTypedList( this.allProducts );
    }

    protected ConfirmStockEntity(Parcel in) {
        this.allStock = in.readInt();
        this.userName = in.readString();
        this.office = in.readString();
        this.isAdd = in.readByte() != 0;
        this.stockChange = in.readString();
        this.type = in.readString();
        this.stateStr = in.readString();
        this.allProducts = in.createTypedArrayList( AllProductsBean.CREATOR );
    }

    public static final Creator<ConfirmStockEntity> CREATOR = new Creator<ConfirmStockEntity>() {
        @Override
        public ConfirmStockEntity createFromParcel(Parcel source) {
            return new ConfirmStockEntity( source );
        }

        @Override
        public ConfirmStockEntity[] newArray(int size) {
            return new ConfirmStockEntity[size];
        }
    };
}